﻿<UserControl x:Class="IS_Ever_Green.View.ModalRecoverPassword"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:IS_Ever_Green.View" 
             xmlns:viewModel="clr-namespace:IS_Ever_Green.ViewModel" xmlns:customcontrols="clr-namespace:IS_Ever_Green.CustomControls"
             mc:Ignorable="d" 
             d:DesignHeight="800" 
             d:DesignWidth="650"
             Background="Transparent"
             >

    <UserControl.DataContext>
        <viewModel:LoginViewModel/>
    </UserControl.DataContext>

    <Border CornerRadius="16"
            Background="#fff">

        <Border.Effect>
            <DropShadowEffect ShadowDepth="5" Color="#000000" Opacity="0.2" BlurRadius="20"/>
        </Border.Effect>

        <StackPanel Orientation="Vertical"
                Margin="20">

            <Button 
                    x:Name="btnBack" 
                    BorderThickness="0"
                    Content="&lt;"
                    Foreground="{StaticResource secondaryTextColor}"
                    FontSize="25"
                    FontFamily="Montserrat"
                    Cursor="Hand"
                    Grid.Column="1"
                    HorizontalAlignment="Left"
                    Click="btnBack_Click"
                    >

                <Button.Style>
                    <Style TargetType="Button">
                        <Setter Property="Background" Value="{StaticResource secondaryButtonColor}"/>
                        <Style.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" Value="{StaticResource secondaryButtonHoverColor}"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>

                <Button.Template>
                    <ControlTemplate TargetType="Button">
                        <Border Width="30" Height="30"
                        CornerRadius="15"
                        Background="{TemplateBinding Background}">

                            <ContentPresenter VerticalAlignment="Center"
                                    HorizontalAlignment="Center"/>

                        </Border>
                    </ControlTemplate>
                </Button.Template>

            </Button>

            <TextBlock Text="Восстановление пароля" 
                Foreground="{StaticResource primaryTextColor}"
                Grid.Column="1" 
                HorizontalAlignment="Center"
                FontSize="25"
                FontFamily="Montserrat"
                />

            <Image Source="/Images/LogoName.png" 
                   Width="250" 
                   Height="90"
                   Margin="0 0 0 20"
                   />

            <TextBlock Text="Login"
               Foreground="{StaticResource primaryTextColor}"
               FontSize="20"
               FontWeight="Medium"
               FontFamily="Montserrat"
               Margin="0 20 0 0"
               />

            <TextBox Text="{Binding Login, UpdateSourceTrigger = PropertyChanged}"
                     Foreground="{StaticResource primaryTextColor}"
                     FontSize="25"
                     FontWeight="Medium"
                     FontFamily="Montserrat"
                     CaretBrush="{StaticResource markerColor}"
                     BorderBrush="{StaticResource primaryTextColor}"
                     BorderThickness="0 0 0 1"
                     Height="35"
                     VerticalContentAlignment="Center"
                     Margin="0 5 0 0"
                     Padding="30 0 0 0"
                     >

                <TextBox.Background>
                    <ImageBrush ImageSource="/Images/User/Login.png"
                        Stretch="none"
                        AlignmentX="Left"
                        />
                </TextBox.Background>
            </TextBox>

            <TextBlock Text="{Binding ErrorMessageLogin}"
                       Foreground="{StaticResource errorMessage}"
                       FontSize="20"
                       FontWeight="Medium"
                       FontFamily="Montserrat"
                       Margin="0 10 0 0"
                       TextWrapping="Wrap"
                       />
            

            <TextBlock Text="Email"
                       Foreground="{StaticResource primaryTextColor}"
                       FontSize="20"
                       FontWeight="Medium"
                       FontFamily="Montserrat"
                       Margin="0 20 0 0"
                       />

            <TextBox Text="{Binding Email, UpdateSourceTrigger = PropertyChanged}"
                     Foreground="{StaticResource primaryTextColor}"
                     FontSize="25"
                     FontWeight="Medium"
                     FontFamily="Montserrat"
                     CaretBrush="{StaticResource markerColor}"
                     BorderBrush="{StaticResource primaryTextColor}"
                     BorderThickness="0 0 0 1"
                     Height="35"
                     VerticalContentAlignment="Center"
                     Margin="0 5 0 0"
                     Padding="30 0 0 0"
                     >

                <TextBox.Background>
                    <ImageBrush ImageSource="/Images/User/Email.png"
                                Stretch="none"
                                AlignmentX="Left"
                                />
                </TextBox.Background>
            </TextBox>

            <TextBlock Text="{Binding ErrorMessageEmail}"
                       Foreground="{StaticResource errorMessage}"
                       FontSize="20"
                       FontWeight="Medium"
                       FontFamily="Montserrat"
                       Margin="0 10 0 0"
                       TextWrapping="Wrap"
                       />


            <TextBlock Text="Пароль" 
                       Foreground="{StaticResource primaryTextColor}"
                       FontSize="20"
                       FontWeight="Medium"
                       FontFamily="Montserrat"
                       Margin="0 20 0 0"
                       />

            <customcontrols:BindablePassword Password="{Binding Password, Mode=TwoWay ,UpdateSourceTrigger = PropertyChanged}"
                                  Height="35"
                                  Margin="0 5 0 0"
                                  >
            </customcontrols:BindablePassword>


            <TextBlock Text="Повторите пароль" 
                       Foreground="{StaticResource primaryTextColor}"
                       FontSize="20"
                       FontWeight="Medium"
                       FontFamily="Montserrat"
                       Margin="0 20 0 0"
                       />

            <customcontrols:BindablePassword Password="{Binding PasswordRepeat, Mode=TwoWay ,UpdateSourceTrigger = PropertyChanged}"
                                  Height="35"
                                  Margin="0 5 0 0"
                                  >
            </customcontrols:BindablePassword>

            <TextBlock Text="{Binding ErrorMessagePassword}"
                       Foreground="{StaticResource errorMessage}"
                       FontSize="20"
                       FontWeight="Medium"
                       FontFamily="Montserrat"
                       Margin="0 10 0 0"
                       TextWrapping="Wrap"
                       /> 


            <Button Command="{Binding RecoverPasswordCommand}"
                    BorderThickness="0"
                    Content="Восстановить пароль"
                    Foreground="{StaticResource secondaryTextColor}"
                    FontSize="16"
                    FontFamily="Montserrat"
                    Cursor="Hand"
                    Grid.Column="1"
                    Margin="0 50 0 0"
                    >

                <Button.Style>
                    <Style TargetType="Button">
                        <Setter Property="Background" Value="{StaticResource primaryButtonColor}"/>
                        <Style.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" Value="{StaticResource primaryButtonHoverColor}"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>

                <Button.Template>
                    <ControlTemplate TargetType="Button">
                        <Border Width="390" Height="50"
                        CornerRadius="16"
                        Background="{TemplateBinding Background}">

                            <ContentPresenter VerticalAlignment="Center"
                                      HorizontalAlignment="Center"/>

                        </Border>
                    </ControlTemplate>
                </Button.Template>

            </Button>

            <Grid>

                <TextBlock Text="{Binding SuccessfullyMessage}"
                           Foreground="{StaticResource successfullyMessage}"
                           FontSize="20"
                           FontWeight="Medium"
                           FontFamily="Montserrat"
                           Margin="0 10 0 0"
                           TextWrapping="Wrap"
                           HorizontalAlignment="Center"
                           />
            
                <TextBlock Text="{Binding ErrorMessage}"
                           Foreground="{StaticResource errorMessage}"
                           FontSize="20"
                           FontWeight="Medium"
                           FontFamily="Montserrat"
                           Margin="0 10 0 0"
                           TextWrapping="Wrap"
                           HorizontalAlignment="Center"
                           />
                
            </Grid>
        </StackPanel>

    </Border>
</UserControl>
